function gcd(a, b) {
    while (b !== 0) {
        let r = a % b;
        a = b;
        b = r;
    }
    return a;
}

function lcm(a, b) {
    return a * b / gcd(a, b);

}

function smallestMult(n) {
    let ans = 1;
    for (let i = 2; i <= n; i++) {
        ans = lcm(ans, i);
    }

    console.log(ans);
    return ans;
}

smallestMult(20);